Skip to content

chore: have a better error message when context bounds are not allowed #23190

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hamzaremmal
Copy link
Member

Closes #22660

@hamzaremmal hamzaremmal force-pushed the i22660 branch 2 times, most recently from 47a1d04 to f95ae7e Compare May 19, 2025 16:08
@hamzaremmal hamzaremmal marked this pull request as ready for review May 19, 2025 16:09
@hamzaremmal hamzaremmal requested a review from KacperFKorban May 19, 2025 16:09
Copy link
Member

@KacperFKorban KacperFKorban left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. Added a style-related comment.

val bounds = typeAndCtxBounds(name)
val res = bounds match
case bounds: ContextBounds if paramOwner.acceptsCtxBounds =>
TypeDef(name, lambdaAbstract(hkparams, bounds)).withMods(mods)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try getting rid of these repetitions? It seems to me that assigning the result is orthogonal to checking the correctness of context bounds. Could you maybe extract the error checking logic to a different function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better error message for contextual bounds on type aliases
2 participants